﻿using System;
using Newtonsoft.Json;

namespace Ecobee.Net
{
	public class ApiColorConverter : JsonConverter
	{
		public override bool CanConvert(Type objectType)
		{
			bool returnValue = false;	

			return returnValue;
		}

		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			object returnValue = null;

			if (objectType == typeof(ApiColor))
			{
				if (existingValue != null)
				{
					returnValue = existingValue;
				}
				else
				{
					returnValue = new ApiColor();
				}

				((ApiColor)returnValue).Value = (long)reader.Value;
			}

			return returnValue;
		}

		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			
		}
	}
}
